home *** CD-ROM | disk | FTP | other *** search
/ Suzy B Software 2 / Suzy B Software CD-ROM 2 (1994).iso / extras / programm / gemfsc20 / gemfsc20.lzh / GNUGEM27 / COMMON.H < prev    next >
C/C++ Source or Header  |  1993-03-24  |  3KB  |  96 lines

  1. /*
  2.  * gemlib bindings     library visible commons only
  3.  *
  4.  *    ++jrb    bammi@cadence.com
  5.  *
  6.  *    modified:  mj --  ntomczak@vm.ucs.ualberta.ca
  7.  */
  8. #ifndef _COMMON_H
  9. #define _COMMON_H
  10.  
  11. /* Array sizes in vdi control block */
  12.  
  13. #define CNTRLMAX    12     /* It seems that 11 is enough - max reached
  14.                for vex_* functions */
  15. #define INTINMAX   255    /* This library will allow strings up to this
  16.                size in v_gtext and vr[qm]_string */
  17. #define INTOUTMAX    45    /* A limit for number of elements in _intout
  18.                for usual functions - reached for v_opnwk */
  19. #define PTSINMAX  1024    /* Max number of points in _ptsin - 2 shorts
  20.                for a point.  Value raised to accomodate
  21.                TT and fsmgdos printer drivers */
  22. #define PTSOUTMAX     6    /* Max number of points in _ptsout - 2 shorts
  23.                for a point.  Max reached in v_opnwk */
  24.  
  25. /* Size for _global in aes control block - most other stuff overlapped
  26.    with arrays for vdi - sizes needed for _control, _int_in, _int_out,
  27.    respectively are 5, 16 and 7 shorts and 2 and 1 longs for
  28.    _addrin and addrout */
  29.  
  30. #define GLOBMAX     15
  31.  
  32. #define _control    (&_contrl[0])
  33. #define _int_in     (&_intin[0])
  34. #define _int_out    (&_intout[0])
  35. #define _addrin     ((void **)(&_ptsin[0]))
  36. #define _addrout    ((void **)(&_ptsout[0]))
  37.  
  38.  
  39. /* code up _control[] elements for __aes__() calls
  40.  * (evaluated at compile time,    no runtime overhead)
  41.  * see common.c for encoding semantics.
  42.  */
  43. #define AES_CONTROL_ENCODE(A, B, C, D) (unsigned long)    \
  44.             (                    \
  45.                  (((unsigned long)A) << 24) |    \
  46.                  (((unsigned long)B) << 16) |    \
  47.                  (((unsigned long)C) <<  8) |    \
  48.                  (((unsigned long)D)      )     \
  49.         )
  50.  
  51. /*
  52.  * code up _contrl[] elements for __vdi__() calls
  53.  * (note with gcc hardly any runtime overhead, most of the uses
  54.  *    end up getting evaluated at compile time)
  55.  * see common.c for encoding semantics.
  56.  */
  57. /*
  58.  * WARNING!! - this coding will accomodate vdi calls with
  59.  *     opcodes      (A) in range 0 - 255
  60.  *     _ptsin size  (B) up to 2047 = 0x7ff nodes (up to 1024 currently used)
  61.  *     _intin size  (C) up to 255  = 0xff  shorts
  62.  *     and subcodes (D) in range 0 - 31
  63.  * Any function for which parameters "stick out" has to be coded
  64.  * without using this macro.  Failure to comply may cause very
  65.  * funny results.
  66.  */
  67. #define VDI_CONTRL_ENCODE(A, B, C, D) (unsigned long)        \
  68.             (                    \
  69.                  (((unsigned long)D) << 27) |    \
  70.                  (((unsigned long)B) << 16) |    \
  71.                  (((unsigned long)C) <<  8) |    \
  72.                  (((unsigned long)A)      )     \
  73.         )
  74.  
  75.  
  76. /* binding arrays */
  77. /* takes care of ptsin containing upto PTSINMAX vertices
  78.  * (tt and fsmgdos require this value to be not smaller than 1024)
  79.  */
  80. #ifndef __IN_COMMON_C__
  81. extern short        _intin[INTINMAX], _intout[INTOUTMAX];
  82. extern short        _ptsin[2 * PTSINMAX], _ptsout[2 * PTSOUTMAX];
  83. extern unsigned short    _contrl[CNTRLMAX], _global[GLOBMAX];
  84. extern int        gl_apid, gl_ap_version;
  85. extern void     *_vdiparams[];
  86. #endif
  87.  
  88. /* aes trap interface func */
  89. int __aes__(unsigned long coded_control);
  90.  
  91. /* vdi trap interface func */
  92. void __vdi__(unsigned long coded_contrl, int handle);
  93. void vdi(void);
  94.  
  95. #endif /* _COMMON_H */
  96.